<?php if ($wallpapers) { ?>
    <?php $id = 'GC_' . uniqid(); ?>
    <?php $show_remaining_items = (isset($show_remaining_items) && $show_remaining_items ? true : false); ?>
    <div data-non_equal_rows="<?php echo $show_remaining_items; ?>" data-block="#<?php echo $id; ?>"
         data-container=".grid_container" data-item=".item" id="<?php echo $id; ?>"
         class="grid_container_block">
        <div class="grid_container">
            <?php $numItems = count($wallpapers);
            $i = 0;
            $width = $this->session->userdata('item_width');
            $per_row = $this->session->userdata('per_row');
            $slice = false;
            if ($per_row) {
                $total_items = count($wallpapers);
                $slice = floor($total_items / $per_row) * $per_row;
            }
            $user_id = $this->user->get_id();
            ?>
            <?php foreach ($wallpapers as $k => $wall) { ?>
                <?php if (!isset($block_ads)){ ?>
                    <?php if ($k == 2) { ?>
                        <?php echo $this->language->get_ad(2); ?>
                    <?php } ?>
                    <?php if ($k == 5) { ?>
                        <?php echo $this->language->get_ad(3); ?>
                    <?php } ?>
                <?php } ?>
                <div
                    style="<?php echo ($width ? 'width:' . $width . 'px;' : '') . ($slice && $slice <= $k ? 'display:none;' : ''); ?>"
                    class="item">
                    <div class="thumbnail">
                        <div class="pr">
                            <?php if ($wall->wallpaper_featured) { ?>
                                <div
                                    class="shape shape-success">
                                    <div class="shape-text"><i class="fa fa-star"></i></div>
                                </div>
                            <?php } ?>
                            <div class="transition name">
                                <div class="block"><?php echo $wall->wallpaper_name; ?></div>
                            </div>
                            <?php $search_replace = array('{C_SLUG_FULL}' => $wall->cFullSlug, '{C_SLUG}' => $wall->category_slug, '{W_SLUG}' => $wall->wallpaper_slug, '{W_HASH}' => $wall->wallpaper_hash); ?>
                            <?php $front_link = $this->route_links->build_link('wallpaper_page', $search_replace); ?>
                            <a href="<?php echo $front_link; ?>">
                                <img class=""
                                     src="<?php echo $this->image_workshop->crop_image(ORIGINALS_FOLDER_WF . '/' . $wall->wallpaper_image_path, 225, 150, $wall->wallpaper_crop_position, 'thumbnail'); ?>"
                                     alt="<?php echo $wall->wallpaper_name; ?>">
                            </a>
                            <?php if ($user_id && $user_id == $wall->user_seq_id) { ?>
                                <div class="transition edit">
                                    <a class="" title="编辑"
                                       href="<?php echo $this->route_links->build_link('upload_wallpaper_edit', array('{hash}' => $wall->wallpaper_hash)) ?>"><i
                                            class="fa fa-edit"></i></a>
                                </div>
                                <div class="transition delete">
                                    <a class="" title="删除"
                                       href="<?php echo $this->route_links->build_link('upload_wallpaper_delete', array('{hash}' => $wall->wallpaper_hash)) ?>"><i
                                            class="fa fa-trash-o"></i></a>
                                </div>
                                <?php if (!$wall->wallpaper_status) { ?>
                                    <div class="disabled">审核通过</div>
                                <?php } ?>
                                <?php if (!$wall->wallpaper_approved) { ?>
                                    <div class="not_approved">未审核</div>
                                <?php } ?>
                            <?php } ?>
                        </div>
                        <div class="wall_stats">
                            <div class="row row-sm">
                                <div class="col-sm-5 hidden-xs">
                                    <div class="size">
                                        <?php echo $wall->wallpaper_width; ?> x <?php echo $wall->wallpaper_height; ?>
                                    </div>
                                </div>
                                <div class="col-xs-12 col-sm-7">
                                    <div class="stats text-right-desk">
                                        <?php if ($wall->total_downloads) { ?>
                                            <i class="fa fa-download"></i> <span
                                                class="space"><?php echo $wall->total_downloads; ?></span>
                                        <?php } ?>
                                        <i class="fa fa-eye"></i> <span
                                            class="space"><?php echo($wall->total_views ? $wall->total_views : 0); ?></span>
                                        <span class="pull-right visible-xs-inline-block">
                                            <?php echo rating_block($wall->vote_up, $wall->vote_down, 5); ?>
                                        </span>

                                        <div class="clearfix"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            <?php } ?>
            <div class="clearfix"></div>
        </div>
    </div>
<?php } else { ?>

    <div class="alert alert-warning">
        还没有壁纸.
    </div>

<?php } ?>
